﻿using DBCompare.Config;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using zTool;
namespace DBCompare
{
    public partial class FrmBaseConfig : Form
    {
        public FrmBaseConfig()
        {
            InitializeComponent();
        }

        private void btnSave_Click(object sender, EventArgs e)
        {
            /*Todo: 写到配置文件*/

            AppCfg.ConnStrOne = txtConnStr1.Text.Trim();
            AppCfg.ConnStrTwo = txtConnStr2.Text.Trim();
            AppCfg.IgorneTable = txtIgonreTable.Text.Trim();
            var path = Application.StartupPath;
            Temp temp = new Temp() {
                ConnStrOne = AppCfg.ConnStrOne,
                ConnStrTwo = AppCfg.ConnStrTwo,
                IgorneTable = AppCfg.IgorneTable,
            };
            File.WriteAllText(path+"\\CoreCfg.dll",temp.ToJson());
            this.Close();
        }
        class Temp
        {
            public string ConnStrOne { get; set; }
            public string ConnStrTwo { get; set; }
            public string IgorneTable { get; set; }
        }

        private void FrmBaseConfig_Load(object sender, EventArgs e)
        {
              txtConnStr1.Text = AppCfg.ConnStrOne;
              txtConnStr2.Text= AppCfg.ConnStrTwo;
              txtIgonreTable.Text = AppCfg.IgorneTable;
        }
    }
}
